﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace VietPublisher.Web.Framework
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");


        //    routes.MapRoute(
        //    "BookView", // Route name
        //    "Book/{bookId}", // URL with parameters
        //    new { controller = "Home", action = "BookView", bookId = "" } // Parameter defaults
        //);
            
          //  routes.MapRoute(
          //"BookCategory", // Route name
          //"Category/{categoryId}", // URL with parameters
          //new { controller = "Home", action = "Category", categoryId = "" } // Parameter defaults
     // );

            routes.MapRoute(
                "Default", // Route name
                "{controller}", // URL with parameters
                new { controller = "home", action = "Index" } // Parameter defaults
            );

            routes.MapRoute(
               "Admin", // Route name
               "{controller}/{action}", // URL with parameters
               new { controller = "book", action = "BookList" } // Parameter defaults
           );

           

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}